<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <title>学科信息</title>
    <style>
        /* Page Styles */
        body {
            font-family: Arial, sans-serif;
            background-color: #f5f1ff;
            color: #4e3d63;
            margin: 0;
            padding: 0;
        }

        .container {
            width: 80%;
            margin: 0 auto;
            padding: 20px;
            background-color: #ffffff;
            border-radius: 8px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
        }

        h1 {
            text-align: center;
            color: #7a4e9f;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }

        table th, table td {
            padding: 12px;
            text-align: center;
            border: 1px solid #ddd;
        }

        table th {
            background-color: #d9c8e2;
        }

        table tr:nth-child(even) {
            background-color: #f9f1ff;
        }

        button {
            padding: 8px 16px;
            margin: 5px;
            border: none;
            background-color: #7a4e9f;
            color: white;
            cursor: pointer;
            border-radius: 4px;
        }

        button:hover {
            background-color: #9b8fa6;
        }

    </style>
</head>
<body>
<div class="container">
    <h1>学院学科信息</h1>

    <!-- 按钮跳转到对应的 JSP 页面 -->
    <a href="editPrimaryDiscipline.jsp"><button>修改一级学科</button></a>
    <a href="editSecondaryDiscipline.jsp"><button>修改二级学科</button></a>
    <a href="editResearchDirection.jsp"><button>修改研究方向</button></a>

    <!-- Primary Disciplines -->
    <c:forEach var="primaryDiscipline" items="${sessionScope.pdi_list}">
        <h2>${primaryDiscipline.primaryDisciplineId} - ${primaryDiscipline.name}</h2>

        <!-- Secondary Disciplines Table -->
        <table>
            <thead>
            <tr>
                <th>二级学科ID</th>
                <th>二级学科名称</th>
                <th>描述</th>
                <th>类型1</th>
                <th>类型2</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach var="secondaryDiscipline" items="${primaryDiscipline.secondaryDisciplineStaticInfos}">
                <tr>
                    <td>${secondaryDiscipline.secondaryDisciplineId}</td>
                    <td>${secondaryDiscipline.name}</td>
                    <td>${secondaryDiscipline.details}</td>
                    <td>${secondaryDiscipline.type1}</td>
                    <td>${secondaryDiscipline.type2}</td>
                </tr>

                <!-- Research Directions Table for Each Secondary Discipline -->
                <tr>
                    <td colspan="5">
                        <h3>研究方向 (${secondaryDiscipline.name})</h3>
                        <table>
                            <thead>
                            <tr>
                                <th>研究方向ID</th>
                                <th>研究方向名称</th>
                            </tr>
                            </thead>
                            <tbody>
                            <c:forEach var="researchDirection" items="${secondaryDiscipline.researchDirections}">
                                <tr>
                                    <td>${researchDirection.researchId}</td>
                                    <td>${researchDirection.researchDirection}</td>
                                </tr>
                            </c:forEach>
                            <c:if test="${empty secondaryDiscipline.researchDirections}">
                                <tr>
                                    <td colspan="2">暂无研究方向</td>
                                </tr>
                            </c:if>
                            </tbody>
                        </table>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </c:forEach>
</div>
</body>
</html>